{% extends 'layout.html' %}

{% block content %}
        <a class="btn btn-primary" style="margin-top: 30px; margin-bottom: 10px; font-weight: 700;" href="/user_add/"><i class="bi bi-plus-circle"></i> 新增用户</a>
        <div style="float: right; width: 300px; margin-top: 30px; margin-bottom: 10px;">
                <form method="get">
                    <div class="input-group">
                        <input type="text" class="form-control" placeholder="输入用户名搜索" aria-label="Recipient's username" aria-describedby="button-addon2" name="u_id" value="{{ search_data }}">
                        <button class="btn btn-outline-secondary" type="submit" id="button-addon2">
                            <i class="bi bi-search"></i>
                        </button>
                    </div>
                </form>
        </div>
        <div class="card">
            <h5 class="card-header" style="font-weight: 700;"><i class="bi bi-people" style="font-size: 23px;"></i> 用户列表</h5>
            <table class="table table-bordered align-middle table-hover text-center">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>姓名</th>
                    <th>密码</th>
                    <th>年龄</th>
                    <th>账户余额</th>
                    <th>入职日期</th>
                    <th>性别</th>
                    <th>部门</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                {% for obj in queryset %}
                <tr>
                    <th>{{ obj.id }}</th>
                    <td>{{ obj.name }}</td>
                    <td>{{ obj.password }}</td>
                    <td>{{ obj.age }}</td>
                    <td>{{ obj.account |floatformat:0}}</td>
                    <td>{{ obj.create_time }}</td>
                    <td>{{ obj.get_gender_display }}</td>
                    <td>{{ obj.depart.title }}</td>
                    <td>
                        <a class="btn btn-primary btn-xs" href="/user/{{ obj.id }}/edit/">编辑</a>
                        <a class="btn btn-danger btn-xs" href="/user/{{ obj.id }}/delete/">删除</a>
                    </td>
                </tr>
                {% endfor %}

                </tbody>
            </table>
            <div style="margin-top: 86px; display: flex; justify-content: center;">
                <ul class="pagination" >
                    {{ page_string }}
                </ul>

            </div>
        </div>
{% endblock %}